<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>yui.js</title>

<script type="text/javascript">

    function log(msg) {

        YAHOO.log(msg);

        /*
        if (typeof console !== "undefined" && console.debug) {
            console.debug(msg);
        } else {
            //alert(msg);
            var d=document, b=d.body, n=d.createElement("div");
            if (b) {
                n.appendChild(d.createTextNode(msg));
                b.appendChild(n);
            }
        }
        */
    }

    YAHOO_config = {
        listener: function(minfo) {
            log("page load listener: " + minfo.name);
        }
    };

</script>

<!--
<link rel="stylesheet" type="text/css" href="../../build/logger/assets/skins/sam/logger.css" />
-->


<script type="text/javascript" src="../../build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../build/dom/dom.js"></script>
<script type="text/javascript" src="../../build/event/event.js"></script>
<!--
<script type="text/javascript" src="../../build/dragdrop/dragdrop.js"></script>
-->
<script type="text/javascript" src="../../build/logger/logger.js"></script>
<script type="text/javascript" src="../../build/get/get.js"></script>


<style id="styleoverrides">

#dd {
    position: relative;
    height: 100px;
    width: 100px;
    background-color: red
}

</style>

</head>
<body class="yui-skin-sam">

<script type="text/javascript">
new YAHOO.widget.LogReader();

// the callback function that must be executed, and the window that we 
// inserted the nodes in
function checkDragDrop(callback, win) {
            if (win.YAHOO.util.DDProxy) {
                callback();
            } else {
                YAHOO.lang.later(3, window, function() {
                        checkDragDrop(callback, win);
                    });
            }
        };

function loadReset() {
    for (var i=0; i<50; i=i+1) {
        // YAHOO.util.Get.css("../../build/reset/reset.css", {
        //     autopurge: true
        // });

        YAHOO.util.Get.script("../../build/cookie/cookie-min.js");

    }

}

YAHOO.util.Event.on("btnLoad", "click", loadReset);


YAHOO.util.Event.on("iframe1", "load", function() {
    YAHOO.log("frame1 loaded (dom2)", "warn");
});

YAHOO.util.Event.on(window, "load", function() {

//YAHOO.util.Event.onDOMReady(function() {

    YAHOO.util.Get.css(["../../build/menu/assets/skins/sam/menu.css",
        "../../build/logger/assets/skins/sam/logger.css"], { 

            onSuccess: function() {
                YAHOO.log("css1 (menu, logger) complet");
            }
        
        } );

    YAHOO.log("css1 executed");

    //alert(document.getElementById("frame1").contentWindow);

    // the path is relative to the win src
    YAHOO.util.Get.css(["../../build/reset-fonts-grids/reset-fonts-grids.css"], {
            //win: document.getElementById("frame1").contentWindow
            //win: frame1
            insertBefore: "styleoverrides",
            onSuccess: function(o) {
                //o.purge();
            }
        });

    YAHOO.log("css2 executed");

    var o = YAHOO.util.Get.script([
            "../../build/yahoo-dom-event/yahoo-dom-event.js",
            //"../../build/yahoo/yahoo.js",
            //"../../build/dom/dom.js",
            //"../../build/event/event.js",
            "../../build/dragdrop/dragdrop.js",
            //"../../build/connection/connection.js"
            //"../../build/menu/menu.js",
        ], {
            onSuccess: function(o) {
                YAHOO.log("onsuccess: " + YAHOO.lang.dump(o.tId));
                var el = document.getElementById("dd");
                if (o.sandbox) {
                    var MYYAHOO = o.sandbox;
                    YAHOO.log("are the YAHOOs the same? " + (MYYAHOO === top.YAHOO));
                    //new MYYAHOO.util.DD(el);
                } else { 
                    // using the local reference
                    new YAHOO.util.DD(el);
                }

                //o.purge();
            },
            onFailure: function(o) {
                YAHOO.log("transaction failed");
            },
            data: "foo",
            varName: ["YAHOO.util.Event", "YAHOO.util.DDProxy"],
            scope: YAHOO,
            charset: "ascii",
            attributes: {
                media: 'screen',
                foo: 'bar'
            },
            autopurge: true,
            onTimeout: function(o) {
                YAHOO.log('Timeout');
            },
            timeout: 2000

            //,sandbox: {
                //reference: "YAHOO"
            //}
        });

    YAHOO.log("Script executed " + o.tId);
});


</script>

<input type="button" name="btnLoad" id="btnLoad" value="Load a bunch"></input>

<iframe name="frame1" onload="YAHOO.log('frame1 loaded (inline)', 'warn')" id="frame1" src="../../build/history/assets/blank.html" height="20" width="400">old browser</iframe>

<h1>header</h1>
<p>YAHOO is already on the page.  We will instantiate a YUILoader instance to load
additional components.  Note that because YAHOO is already on the page, we are not
able to take advantage of the automatic rollup capability (we load dom and event 
individually instead of yahoo-dom-event).</p>
<div id="dd"></div>
<div id="doc"></div>

</body>
</html>
